home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue24 / survive / TABLES.SQL < prev    next >
Encoding:
Text File  |  1997-06-11  |  1.8 KB  |  69 lines

  1. connect "e:\sst\articles\9708\code\demo.gdb"
  2.   user "SYSDBA" password "masterkey";
  3.  
  4. create generator Gen_CreditNo;
  5. create generator Gen_PaymentNo;
  6. commit;
  7.  
  8. drop table PaymentMethods;
  9. create table PaymentMethods
  10. (
  11.   PayMethodCode      char(2) not null primary key,
  12.   PayMethodName      char(20) not null,
  13.   Sequence           smallint not null
  14. );
  15. commit;
  16.  
  17. insert into PaymentMethods values ('CS', 'Cash',              1);
  18. insert into PaymentMethods values ('CK', 'Personal Check',    2);
  19. insert into PaymentMethods values ('TC', 'Traveler''s Check', 3);
  20. insert into PaymentMethods values ('CC', 'Cashier''s Check',  4);
  21. insert into PaymentMethods values ('OT', 'Other',             5);
  22.  
  23. drop table Credits;
  24. create table Credits
  25. (
  26.   CreditNo        integer not null primary key,
  27.   Status          char(1) default 'V' not null,
  28.   CustNo          integer not null,
  29.   Amount          float default 0 not null,
  30.   BalanceDue      float default 0 not null,
  31.   IssueDateTime   date default 'now' not null
  32. );
  33. commit;
  34.  
  35. drop table Payments;
  36. create table Payments
  37. (
  38.   PaymentNo       integer not null primary key,
  39.   CustNo          integer not null,
  40.   Amount          float default 0 not null,
  41.   PaymentDateTime date default 'now' not null
  42. );
  43. commit;
  44.  
  45. drop table PaymentCredits;
  46. create table PaymentCredits
  47. (
  48.   PaymentNo       integer not null,
  49.   CreditNo        integer not null,
  50.   Amount          float not null,
  51.   BalanceDue      float not null,
  52.   primary key (PaymentNo, CreditNo)
  53. );
  54. commit;
  55.  
  56. drop table PaymentAllocation;
  57. create table PaymentAllocation
  58. (
  59.   PaymentNo       integer not null,
  60.   CreditNo        integer not null,
  61.   PayMethodCode   char(2) not null,
  62.   Amount          float not null,
  63.   primary key (PaymentNo, CreditNo, PayMethodCode)
  64. );
  65. commit;
  66.  
  67. exit;
  68.  
  69.